<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'north',border:false">
		<form class="appForm">
			<div class="datagrid-toolbar">
				<table class="appTable">
					<tr>
						<td>
							<input name="Q_sys_menu->name_like" data-options="prompt:'菜单名称'" class="easyui-textbox" type="text" style="width:100px;"/>
							<input name="Q_sys_role->name_like" data-options="prompt:'角色名称'" class="easyui-textbox" type="text" style="width:100px;"/>
							<button type="submit" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</button>
							<button type="button" onclick="$(this).parents('form').eq(0).form('reset');" class="easyui-linkbutton" data-options="iconCls:'icon icon-reset'">清空</button>
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<div data-options="region:'center',border:false">
		<table class="appGrid"></table>
	</div>
</div>
<script type="text/javascript">
	var grids = $("table.appGrid");
	grids.eq(grids.size()-1).datagrid({
		id:'dg',
		url:_ctx+'/admin/menu/roleMenuList',
		multiSort:true,
		columns:[[
			{field:'id',checkbox:true},
			{field:'menu_name',title:'菜单',width:100,sortable:true},
			{field:'role_name',title:'角色名',width:100,sortable:true}
		]],
		appToolbar: [{
			iconCls: 'icon icon-delete',
			text:'删除',
			key:'menu_auth_query',
			handler: function(){
				var grid = getDatagrid(this);
				var rows = grid.datagrid("getSelections");
				if(rows.length==0){
					$.appAlert("请选择要删除的记录！");
					return;
				}
				var ids = [];
				$.each(rows,function(i,r){
					ids.push(r.id);
				});
				$.appAjax({
					url:_ctx+"/admin/menu/delRoleMenu",
					data:{"Q_id_in":ids.join(',')},
					//以下为可选封装
					grid:grid.get(0),
					confirmTitle:'确认删除选择的记录？'
				});
			}	
		}]
	});
</script>